﻿using MediatR;
using S.EarTag.API.Application.MediatorCommand.BodyMeasureCommand;
using S.EarTag.Infrastructure.Repository.Interface.IEarTagRepository;

namespace S.EarTag.API.Application.MediatorCommandHandler.BodyMeasureCommandHandler
{
    public class BodyMeasureDeleteCommandHandler : IRequestHandler<BodyMeasureDeleteCommand, bool>
    {
        private readonly IBodyMeasureModelRepository _bodyMeasureModelRepository;
        public BodyMeasureDeleteCommandHandler(IBodyMeasureModelRepository bodyMeasureModelRepository)
        {
            _bodyMeasureModelRepository = bodyMeasureModelRepository;
        }
        /// <summary>
        /// 根据Id删除体尺测量数据
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public async Task<bool> Handle(BodyMeasureDeleteCommand request, CancellationToken cancellationToken)
        {
            return await _bodyMeasureModelRepository.DeleteAsync(request.BodyMeasureId);
        }
    }
}
